<template>
	<view class="content">
		<view class="info-block">
			<view class="title">职位描述</view>
			<view class="text">
				详细的职位描述更能获得求职者的关注，请勿填写具体联系方式、违反广告法词语、歧视词语等相关内容。详情可查看<text @click="openItem">《职位审核常见违规词》</text>
			</view>
			<view v-if="displayChoose" class="choose-block">
				<view class="choose-content">
					<view class="choose">
						<view class="title-item">
							<view class="choose-title">职位审核常见违规词</view>
							<view class="iconfont icon-guanbi" @click="chooseItem"></view>
						</view>
						<view class="choose-item">
							1.请勿填写违反新广告法的词汇如:最大、最好等“最”相关词:第一、唯一等“一”相关词:首个、首家等“首”相关词:其它涉及虚假宣传、欺诈诱导性的词汇</br>
							2.请勿填写涉及性别/婚育歧视的词汇如:男/女性优先、仅限男/女性、已婚/未婚、已育等</br>
							3.请勿填写涉及地域歧视的词汇如:本地人优先、本地户口、某某市户籍等</br>
							4.请勿填写包含电话、电子邮箱、QQ、微博、微信等联系方式的内容</br>
							5.请勿填写包含网络链接、公司官网等内容</br>
							6.其它违法违规的词汇
						</view>
					</view>
				</view>
			</view>
			<textarea v-model="jobDescription" class="form-ctrl" maxlength="-1" :placeholder="placeholder"
				auto-focus='true'></textarea>
			<view class="btn-item">
				<view class="btn" @click="handleSave">保存</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		findAllJobById as getInfoById,
	} from '@/api/position.js';
	export default {
		data() {
			return {
				placeholder: `1.工作内容 2.任职要求 3.亮点说明`,
				jobDescription: '',
				id: 0,
				displayChoose: false,
			}
		},
		methods: {
			handleSave() {
				let data = JSON.parse(JSON.stringify(this.jobDescription));
				if (data === '') {
					this.showToast('请填写职位描述！');
				} else {
					uni.$emit('getJobDescription', data);
					uni.navigateBack()
				}
			},
			getInfo() {
				getInfoById({
					id: this.id
				}).then((res) => {
					this.jobDescription = res.jobDescription;
				}).catch((res) => {
					reject(res)
				})
			},
			chooseItem() {
				this.displayChoose = false
			},
			openItem() {
				this.displayChoose = true
			}
		},
		onLoad(e) {
			this.id = e.id
			if (this.id != 0) {
				this.getInfo()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		height: 100%;
		padding: 30rpx;
		position: relative;
		padding-bottom: 120rpx;

		.info-block {
			display: flex;
			flex-direction: column;

			.title {
				font-size: 50rpx;
				font-weight: bold;
			}

			.text {
				color: #999;
				font-size: 30rpx;
				margin-top: 30rpx;
				line-height: 48rpx;
				margin-bottom: 20rpx;
			}

			text {
				color: #0000FF;
			}

			.choose-block {
				position: fixed;
				left: 0;
				top: 0;
				background: rgba(0, 0, 0, 0.2);
				z-index: 999;
				width: 100vw;
				height: 100vh;

				.choose-content {
					width: 100%;
					height: auto;
					background: #fff;
					z-index: 9999;
					position: fixed;
					transform: translate(-50%, 0%);
					left: 50%;
					bottom: 0;
					display: flex;
					flex-direction: column;
					box-shadow: 0 0 10px 0px #dadada;

					.choose {
						display: flex;
						flex-direction: column;
						padding: 30rpx;
						background-color: #F6F6F6;

						.title-item {
							display: flex;
							flex-direction: row;
							justify-content: space-between;
							margin-bottom: 30rpx;
							padding-bottom: 20rpx;
							border-bottom: 1rpx solid #dadada;

							.choose-title {
								font-size: 36rpx;
								font-weight: bold;
							}
						}

						.choose-item {
							margin-top: 10rpx;
							font-size: 30rpx;
							line-height: 50rpx;
							margin-bottom: 50rpx;
						}

					}

					.btn1 {
						margin-top: 50rpx;
						height: 60rpx;
						width: 300rpx;
						border-radius: 20rpx;
						margin-bottom: 30rpx;
					}
				}
			}

			textarea {
				width: 100%;
				height: 900rpx;
			}

			.btn-item {
				display: flex;
				justify-content: center;

				.btn {
					width: 400rpx;
					height: 60rpx;
					border-radius: 40rpx;
					background-color: #FF7626;
					display: flex;
					justify-content: center;
					align-items: center;
					align-content: center;
					color: #fff;
					margin-top: 40rpx;
				}
			}

		}
	}
</style>
